<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
		<link rel="stylesheet" href="static/css/bootstrap.min.css" />
		<link rel = "stylesheet" href = "static/css/globle.css"/>
		
		<script type="text/javascript" src = "static/js/jquery.js"></script>
		<style type="text/css">
			.list{
				margin-top:40px;
			}
			.list li a{
				margin-left:6px;
				font-size:16px;
			}
			.list li{
				line-height:30px;
			}
		</style>
	<title></title>
</head>
<body>
 <div class="navbar navbar-fixed-top" id = "manager">
			<div class="navbar-inner">
				<div class="container">
					<a  class = "brand" href="#">项目管理系统</a>
			
				</div>
			</div>
</div>
	<div class="container" style = "margin-top:60px">
		<div class="row" style = "margin-top:10px">
			<div class="span3">
				<div style="padding: 8px 0;" class="well">
					<ul class="nav nav-list">
					  <li class="nav-header">${project.p_name }</li>
					  <li ><a href="#"><i class=" icon-home"></i>最新动态</a></li>
					  <li><a href="goal.jspx?p_id=${project.p_id }"><i class="icon-flag"></i>目标</a></li>
					  <li><a href="material.jspx?pid=${project.p_id }"><i class="icon-folder-open"></i>资料库</a></li>
					  <li><a href ="fileShare.jspx?pid=${project.p_id }"><i class="icon-file"></i>文件共享</a></li>
					  <li class="active"><a href="contact.jspx?pid=${project.p_id }"><i class="icon-white icon-user"></i>联系人</a></li>
					  <li><a href="idear.jspx?pid=${project.p_id }"><i class="icon-fire"></i>想法</a></li>
					  <li><a href="#"><i class="icon-warning-sign"></i>Bug</a></li>
					  <li><a href="#"><i class="icon-cog"></i>项目设置</a></li>
					</ul>
				</div>
			</div>
			<div class = "span9">
				<ul class="breadcrumb" style = "margin-top:20px;margin-bottom:0px;border-radius:3px 3px 0 0;hegiht:20px;border-bottom:none">
					<li class = "active "><i class="icon-user"></i>联系人列表</li>
				</ul>
				<div class = "well" style = "border-radius:0 0 3px 3px;height:460px;background-color:white">
					
					 
					<div class = "row">
						<div class = "span3" style = "border-right:1px solid #ccc;height:450px">
							<a href="contact.jspx?_m=add" class="btn btn-primary span2"><i class="icon-plus"></i>添加联系人</a>
							<div class = "list">
								<ul style = "list-style-type:none">
									<c:forEach items = "${contacts }" var = "contact">
										<li><i class="icon-list-alt"></i><a href = "javascript:;"  rel = "${contact.c_id }" onclick = show(this)>${contact.c_name}</a></li>
									</c:forEach>
								</ul>
							</div>
						</div>
						<div class = "span5">
							<div id = "result">
								<h2>name</h2>
								<div>****公司</div>
								<div>手机</div>
								<div>固话</div>
								<br/>
								<div>邮箱</div>
								<div>地址</div>
								<br/>
								<div>个人主页</div>
								<div>weibo</div>
								
							
					</div>
					
				</div>
				
				
			</div>
					
				
			
			
		</div>
	</div>
	<script type="text/javascript">
		var xmlHttp;
		function createXMLHttp(){
			if(window.ActiveXObject){
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} else{
				xmlHttp = new XMLHttpRequest();
			}
		}
		function show(obj){
			createXMLHttp();
			var cid = $(obj).attr("rel");
			xmlHttp.open("get","contact.jspx?_m=show&contactid="+cid,true);
			xmlHttp.onreadystatechange = callback;
			xmlHttp.send();
			
			}
		function callback(){
			if(xmlHttp.readyState == 4) {
				if(xmlHttp.status == 200) {
					var json = JSON.parse(xmlHttp.responseText);
					var cid = json.c_id;
					$("#result").text("");
					$("#result").append($("<h2>"+json.c_name+"</h2>"));
					$("#result").append($("<div>"+json.c_company+"</div>"));
					$("#result").append($("<div>"+"手机:"+json.c_mobile+"</div>"));
					$("#result").append($("<div>"+"固话:"+json.c_tel+"</div>"));
					$("#result").append($("<br>"));
					$("#result").append($("<div>"+"邮箱："+json.c_email+"</div>"));
					$("#result").append($("<div>"+"地址："+json.c_address+"</div>"));
					$("#result").append($("<br>"));
					$("#result").append($("<div>"+"主页"+json.c_website+"</div>"));
					$("#result").append($("<div>"+"微博："+json.c_weibo+"</div>"));	
					$("#result").append($("<br>"));
					$("#result").append($("<div>"+"联系人简介："+json.c_introduct+"</div>"));
					//$("#result").append($("<div><a class='btn btn-primary' href='contact.jspx?_m=edit&contactid='+cid <i class='icon-pencil icon-white'>"+"编辑"+"</i></a><div>"));
					var div = document.createElement("div");
					var a = document.createElement("a");
					var i = document.createElement("i");
					
					a.setAttribute("href","contact.jspx?_m=edit&contactid="+cid);
					i.setAttribute("class","icon-pencil");
					
					//i.appendChild(content);
					//a.appendChild(content);
					a.appendChild(i);
					div.appendChild(a);
					$("#result").append($("<br>"));
					document.getElementById("result").appendChild(div);
					
					//<a class="btn btn-danger"><i class="icon-trash icon-white"></i>删除</a>
						//alert(json.c_id);
					
					
				}else{
					alert(xmlHttp.status);
				}
			}else{
				//loading
			}
		}
	</script>
</body>
</html>